<!doctype html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="chrome=1">
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
		<style type="text/css">
			body,
			html,
			#container {
				height: 100%;
				margin: 0px;
				font: 12px Arial;
			}
			
			.taiwan {
				border: solid 1px red;
				color: red;
				float: left;
				width: 50px;
				background-color: rgba(255, 0, 0, 0.1)
			}
		</style>
		<title>Marker example</title>
	</head>

	<body>
		<div id="container" tabindex="0"></div>
		<script src="http://webapi.amap.com/js/marker.js"></script>
		<script src="http://webapi.amap.com/maps?v=1.3&key=您申请的key值"></script>
		<script type="text/javascript">
			var mapObj = new AMap.Map('container', {
				resizeEnable: true,
				zoom: 4
			});
			var markers = []; //province见Demo引用的JS文件
			for (var i = 0; i < provinces.length; i += 1) {
				var marker;
				if (provinces[i].type === 0) {
					var icon = new AMap.Icon({
						image: 'http://vdata.amap.com/icons/b18/1/2.png',
						size: new AMap.Size(24, 24)
					});
					var content = "<div class = 'taiwan'>宝岛台湾</div>";
					marker = new AMap.Marker({
						icon: icon,
						content: content,
						position: provinces[i].center.split(','),
						offset: new AMap.Pixel(-12, -12),
						zIndex: 101,
						title: provinces[i].name,
						map: mapObj
					});
				} else {
					marker = new AMap.Marker({
						position: provinces[i].center.split(','),
						title: provinces[i].name,
						map: mapObj
					});
					if (provinces[i].type === 2) {
						var content = "<div class = 'taiwan'>宝岛台湾</div>";
						var baodao = new AMap.Marker({
							content: content,
							position: provinces[i].center.split(','),
							title: provinces[i].name,
							offset: new AMap.Pixel(0, 0),
							map: mapObj
						});
						mapObj.setCenter(baodao.getPosition());
					}
				}
				markers.push(marker);
			}
		</script>
	</body>

</html>